程式是一種雙重存在的實體,常被描述為 「機器中的幽靈」。 它同時以人類撰寫的靜態文字形式存在,也作為一個動態且無形的機器,操控著實際的硬體設備。電腦僅是這些基於邏輯的構造物的 載體 而已。
1. 三重存在
程式以三種方式呈現:可讀的原始碼、記憶體中的二進位資料,以及控制記憶體的主動力量。程式設計師是 宇宙的創造者 幾乎無限複雜的宇宙創造者,其運作完全由他們所定義的邏輯所支配。
實體載體
實體硬體、大型主機與電路。
實體硬體、大型主機與電路。
無形的來賓
邏輯、『幽靈』,以及程式的意圖。
邏輯、『幽靈』,以及程式的意圖。
2. 控制複雜度
程式設計是一門 掌控複雜度的技能。優秀的程式能讓複雜的事物顯得簡單。雖然電腦語言比人類語言缺乏彈性,但透過嚴格的語法規則,確保了精確性。
超越瀏覽器: 若要在網頁瀏覽器之外執行本課程所定義的程式,可以使用 Node.js。
我們將建立的宇宙: 人工生命模擬 • 平台遊戲 • 繪圖程式 • 動態網站
main.py
TERMINALbash — 80x24
> Ready. Click "Run" to execute.
>
QUESTION 1
In the context of the 'Ghost in the Machine', what is the role of the physical computer?
It is the primary source of intelligence.
It acts as a host for the immaterial machine (the program).
It is the 'Ghost' itself.
It is a human-readable text repository.
✅ Correct!
The computer is the physical host that provides the environment for the program to act as an immaterial machine.❌ Incorrect
The computer is the hardware 'host'; the program is the directing 'ghost'.QUESTION 2
According to the text, what is the 'art of programming'?
Writing as many lines of code as possible.
The skill of controlling and subduing complexity.
Making a program as grammatically flexible as English.
Designing hardware components.
✅ Correct!
The great program is simple in its complexity; the goal is to manage and subdue intricate logic.❌ Incorrect
Complexity should be subdued and made simple, not merely increased.QUESTION 3
Which of these is NOT one of the 'three things' a program is simultaneously?
A piece of text typed by a programmer.
Data residing in the computer's memory.
A physical transistor inside the CPU.
The force directing the computer's actions.
✅ Correct!
Programs are immaterial machines; they are text, data, and logic, not the physical transistors themselves.❌ Incorrect
The 'Triple Existence' includes text, memory data, and the directing force.QUESTION 4
How do computer languages compare to human languages in terms of grammar?
They are more grammatically flexible.
They follow no grammatical rules.
They are typically less grammatically flexible.
They are identical in every way.
✅ Correct!
Computer languages require absolute precision and are less flexible than natural human languages.❌ Incorrect
Computer languages are rigid and require strict adherence to syntax.QUESTION 5
What platform is recommended to run JavaScript programs outside of the web browser?
Java Runtime Environment
Node.js
Python Desktop
HTML5 Engine
✅ Correct!
Node.js allows you to execute JavaScript directly on your machine without a browser.❌ Incorrect
Node.js is the standard environment for running JS logic server-side or on the desktop.Case Study: The Architect of Universes
Complexity Management in Digital Systems
You are tasked with building an artificial life simulation. The logic involves thousands of entities interacting, yet you must ensure the program remains readable and maintainable for other developers.
Q
Explain how the program acts as a 'directing force' in this simulation.
Solution:
The program is the 'ghost' that dictates how data in the computer's memory (representing biological entities) moves and changes, transforming static values into dynamic behaviors.
The program is the 'ghost' that dictates how data in the computer's memory (representing biological entities) moves and changes, transforming static values into dynamic behaviors.
Q
If the simulation becomes too complex for one person to understand, which core principle of programming has been violated?
Solution:
The principle of 'subduing complexity.' The art of programming is making the complex simple; if it becomes unmanageable, the complexity has not been properly controlled.
The principle of 'subduing complexity.' The art of programming is making the complex simple; if it becomes unmanageable, the complexity has not been properly controlled.
Q
How does the 'Triple Existence' concept apply to your simulation code?
Solution:
It exists as the text you type (source), the data the computer stores about the entities (memory), and the execution logic that processes every interaction (force).
It exists as the text you type (source), the data the computer stores about the entities (memory), and the execution logic that processes every interaction (force).